import cherrypy
import sha
from django.utils import simplejson

from app.controllers.login import LoginController

class LoginHandler(object):
	@cherrypy.expose
	def index(self):
		pass

	@cherrypy.expose		
	def check(self):
		return simplejson.dumps({'msg':'loggedout'})
  
	@cherrypy.expose	
	def auth(self,uname=None,pword=None):
		if LoginController.getUser(uname,pword).uname:
			return simplejson.dumps({'msg':'Succeded'})
		else: 
			return simplejson.dumps({'msg':'Failure'})